﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Watson.TemporaryFilesDeleter
{
    /// <summary>
    /// Event arguments for the <see cref="FileDelete.ProgressChanged"/> event.
    /// </summary>
    public class ProgressChangedEventArgs : EventArgs
    {
        #region Private Read-only Fields

        /// <summary>
        /// The percentage, from 0 to 100, of the operation that is complete.
        /// </summary>
        private readonly byte progressPercentage;

        #endregion

        #region Public Properties

        /// <summary>
        /// Gets the percentage, from 0 to 100, of the operation that is
        /// complete.
        /// </summary>
        public byte ProgressPercentage
        {
            get { return this.progressPercentage; }
        }

        #endregion

        #region Public Constructors

        /// <summary>
        /// Initialises a new instance of the ProgressChangedEventArgs class.
        /// </summary>
        public ProgressChangedEventArgs()
        { }

        /// <summary>
        /// Initialises a new instance of the ProgressChangedEventArgs class
        /// specifying a value for the percentage, from 0 to 100, of the 
        /// operation that is complete.
        /// </summary>
        /// <param name="percentProgress"/> 
        /// The percentage, from 0 to 100, of the operation that is complete.
        /// </param>
        /// <exception cref="System.ArgumentOutOfRangeException">
        /// <paramref name="progressPercentage"/> was not within the acceptable
        /// range of 0-100.
        /// </exception>
        public ProgressChangedEventArgs(byte progressPercentage)
        {
            if (progressPercentage < 0 || progressPercentage > 100)
            {
                throw new ArgumentOutOfRangeException("progressPercentage",
                    "Must be within 0 and 100 (inclusive).");
            }


            this.progressPercentage = progressPercentage;
        }

        #endregion
    }
}
